<template>
  <div class="simple-home">
    <h1>现代化博客系统</h1>
    <p>欢迎使用博客系统！</p>
    <div class="actions">
      <el-button type="primary" @click="$router.push('/posts')">浏览文章</el-button>
      <el-button @click="$router.push('/write')" v-if="userStore.isLoggedIn">写文章</el-button>
      <el-button @click="$router.push('/login')" v-else>登录</el-button>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useUserStore } from '@/stores/user'

const userStore = useUserStore()
</script>

<style scoped>
.simple-home {
  padding: 2rem;
  text-align: center;
}

.actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}
</style>
